import os
import platform
import sys


# 10排序函数
def clean_sort(input_file, range, sort_type):
    """

    :param input_file:输入文件地址
    :param range: 数组格式[min,max]表示取样范围
    :param sort_type: 排序类型
    :return: 数组格式输出数据
    """
    # 0:正序 1：负序
    dict_type = {0: False, 1: True}

    sort_type = int(sort_type)

    with open(input_file) as file_obj:
        array = eval(file_obj.read())
        after = []
        # 取范围
        for value in array:
            if range[0] <= value <= range[1]:
                after.append(value)
        # 排序
        after.sort(reverse=dict_type[sort_type])

        return after


if __name__ == '__main__':
    print(clean_sort(sys.argv[1], eval(sys.argv[2]), sys.argv[3]))
